<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/shareViews.js"></script>
<script type="text/javascript" src="js/md5.js"></script>
<script type="text/javascript" src="js/herohelper.js"></script>
<script type="text/javascript" src="js/hero.js"></script>
<script type="text/javascript">
Hero.viewWillAppear = function(){
    localStorage.phone = '';
    Hero.datas({name:'loginContainner',subViews:[
        {
            class:'HeroButton',
            frame:{x:'0',y:'36',w:'60',h:'26'},
            title:'点击登录',
            size:12,
            borderColor:'ffffff',
            titleColor:'ffffff',
            click:[{command:'present:'+path+'/login.html'},{command:{'showMenu':false}}]
        }
    ]});
}
Hero.on = function(json){
    if (json.name === 'phone') {
        if(Hero.ui2Data.phone && Hero.ui2Data.phone.length === 11){
            window.phone = Hero.ui2Data.phone;
            Hero.datas({name:'loginBtn',enable:true})
        }else{
            Hero.datas({name:'loginBtn',enable:false})
        }
    }
    if (json.click === 'login') {
        if (!(/^1[34578]\d{9}$/.test(Hero.ui2Data.phone))) {
            Hero.datas({name:'toast',text:'请输入合法手机号'})
        }else{
            window.HeroHelper.get('/fag/recv',{service:'login',identity_id:Hero.ui2Data.phone,identity_type:'MOBILE'},function(json){
                localStorage.phoneTmp = Hero.ui2Data.phone;
                localStorage.ticket = json.ticket;
                Hero.command('goto:'+path+'/login1.html');
            });
        }
    };
    if (json.click === 'lisence') {
    };
}
Hero.ui = {
    version:0,
    backgroundColor:'ffffff',
    tintColor:'000000',
    nav:{
        navigationBarHidden:false,
        title:'手机快捷登陆',
    },
    views:[
        {
            class:'HeroTextField',
            type:'phone',
            frame:{x:'0.1x',r:'0.1x',y:'124',h:'50'},
            placeHolder:'手机号码',
            name:'phone',
            text:localStorage.phone||'',
            textFieldDidEditing:{textfield:'change'},
        },
        {
            jsClass:'lineView',
            frame:{x:'0.1x',r:'0.1x',y:'174',h:'1'},

        },
        {
            class:'HeroButton',
            frame:{x:'0.1x',w:'90',y:'184',h:'30'},
            title:'使用密码登录',
            size:14,
            titleColor:tintColorL,
            click:{command:'load:'+path+'/login_pass.html'}
        },
        {
            jsClass:'bigButton1',
            name:'loginBtn',
            enable:false,
            frame:{x:'0.1x',r:'0.1x',y:'234',h:'44'},
            title:'下一步',
            click:{click:'login'}
        },
        {
            class:'HeroLabel',
            frame:{w:'1x',h:'30',b:'60'},
            text:'注册成功即代表您同意《用户协议》',
            alignment:'center',
            size:12,
            textColor:'aaaaaa',
            attribute:{
                'color(10,9)':'666666',
            },
        },
        {
            class:'HeroButton',
            frame:{w:'1x',h:'30',b:'60'},
            click:{click:'lisence'}
        },
        {
            class:'HeroToast',
            name:'toast',
        },

    ],
}

</script>
</head>
</html>
